﻿namespace MicroCloud.Audits
{
    /// <summary>
    /// 审计实体条目
    /// </summary>
    public class AuditEntityEntry
    {
        #region 构造函数
        /// <summary>
        /// 初始化一个审计实体条目 <see cref="AuditEntityEntry"/> 的新实例
        /// </summary>
        public AuditEntityEntry()
            : this(null, null, OperateType.Query)
        { }

        /// <summary>
        /// 初始化一个审计实体条目 <see cref="AuditEntityEntry"/> 的新实例
        /// </summary>
        /// <param name="name">实体名称</param>
        /// <param name="typeName">类型名称</param>
        /// <param name="operateType">操作类型</param>
        public AuditEntityEntry(string name, string typeName, OperateType operateType)
        {
            Name = name;
            TypeName = typeName;
            OperateType = operateType;
            PropertyEntries = new List<AuditPropertyEntry>();
        }

        #endregion

        #region 属性
        /// <summary>
        /// 获取或设置 实体名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 获取或设置 类型名称
        /// </summary>
        public string TypeName { get; set; }

        /// <summary>
        /// 获取或设置 数据编号
        /// </summary>
        public string EntityKey { get; set; }

        /// <summary>
        /// 获取或设置 操作类型
        /// </summary>
        public OperateType OperateType { get; set; }

        /// <summary>
        /// 获取或设置 属性条目集合
        /// </summary>
        public ICollection<AuditPropertyEntry> PropertyEntries { get; set; }

        /// <summary>
        /// 获取或设置 关联实体
        /// </summary>
        public object Entity { get; set; }

        #endregion

    }
}
